Change in openvpn[master]: Fix warnings on Android about unused variables/methods
A message that is not in the archive (sent off-list or not yet received): gerrit.1739460301000.I33d1d04b59c62e87ab61d768a7201124ccdabd07@...2715...
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/894?usp=email
to review the following change.
Change subject: Fix warnings on Android about unused variables/methods
......................................................................
Fix warnings on Android about unused variables/methods
The changes to route.c are a bit messy but they mostly modify already existing ifdefs
---
M src/openvpn/route.c
M src/openvpn/tun.c
2 files changed, 13 insertions(+), 8 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/94/894/1
src/openvpn/route.c +12 -6
@@ -104,6 +104,7 @@#define RTA_SUCCESS 1/* route addition succeeded */ #define RTA_EEXIST 2/* route not added as it already exists */ +#ifndef TARGET_ANDROID static bool add_bypass_address (struct route_bypass *rb,const in_addr_t a) {
@@ -125,6 +126,7 @@ return false; } } +#endif /* ifndef TARGET_ANDROID */ struct route_option_list *new_route_option_list (struct gc_arena *a)
@@ -750,6 +752,7 @@* (not the most beautiful implementation in the world, but portable and * "good enough") */ +#ifndef TARGET_ANDROID static bool route_ipv6_match_host (const struct route_ipv6 *r6,const struct in6_addr *host )
@@ -785,6 +788,7 @@return false; } +#endif /* ifndef TARGET_ANDROID */ bool init_route_ipv6_list(struct route_ipv6_list *rl6,
@@ -2183,7 +2187,7 @@ const struct env_set *es, openvpn_net_ctx_t *ctx) { -#if !defined(TARGET_LINUX ) +#if !defined(TARGET_LINUX ) && !defined(TARGET_ANDROID )const char *network;#if !defined(TARGET_AIX )const char *netmask;
@@ -2191,9 +2195,11 @@#if !defined(TARGET_ANDROID )const char *gateway;#endif -#else /* if !defined(TARGET_LINUX) */ +#else /* if !defined(TARGET_LINUX) && !defined(TARGET_ANDROID) */ +#if !defined(TARGET_ANDROID )int metric;#endif +#endif int is_local_route;if ((r->flags & (RT_DEFINED |RT_ADDED )) != (RT_DEFINED |RT_ADDED ))
@@ -2204,7 +2210,7 @@struct gc_arena gc =gc_new ();struct argv argv =argv_new (); -#if !defined(TARGET_LINUX ) +#if !defined(TARGET_LINUX ) && !defined(TARGET_ANDROID ) network =print_in_addr_t (r->network,0 , &gc);#if !defined(TARGET_AIX ) netmask =print_in_addr_t (r->netmask,0 , &gc);
@@ -2394,10 +2400,10 @@ }#if !defined(_WIN32) -#if !defined(TARGET_LINUX ) +#if !defined(TARGET_LINUX ) && !defined(TARGET_ANDROID )const char *gateway;#endif -#if !defined(TARGET_SOLARIS ) +#if !defined(TARGET_SOLARIS ) && !defined(TARGET_ANDROID )bool gateway_needed = false;const char *device = tt->actual_name;if (r6->iface !=NULL )/* vpn server special route */
@@ -2421,7 +2427,7 @@struct argv argv =argv_new (); network =print_in6_addr ( r6->network,0 , &gc); -#if !defined(TARGET_LINUX ) && !defined(_WIN32) +#if !defined(TARGET_LINUX ) && !defined(_WIN32) && !defined(TARGET_ANDROID ) gateway =print_in6_addr ( r6->gateway,0 , &gc);#endif
src/openvpn/tun.c +1 -2
@@ -1888,7 +1888,7 @@#endif -#if !(defined(_WIN32) || defined(TARGET_LINUX ) || defined(TARGET_SOLARIS )) +#if !(defined(_WIN32) || defined(TARGET_LINUX ) || defined(TARGET_SOLARIS ) || defined(TARGET_ANDROID ))static void open_tun_generic (const char *dev,const char *dev_type,const char *dev_node,struct tuntap *tt)
@@ -2062,7 +2062,6 @@ openvpn_net_ctx_t *ctx) {#define ANDROID_TUNNAME "vpnservice-tun" -struct user_pass up;struct gc_arena gc =gc_new ();bool opentun;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/894?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I33d1d04b59c62e87ab61d768a7201124ccdabd07
Gerrit-Change-Number: 894
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/894?usp=email
to look at the new patch set (#4).
Change subject: Fix warnings on Android about unused variables/methods
......................................................................
Fix warnings on Android about unused variables/methods
The changes to route.c are a bit messy but they mostly modify already existing ifdefs
---
M .github/workflows/build.yaml
M src/openvpn/route.c
M src/openvpn/tun.c
3 files changed, 14 insertions(+), 9 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/94/894/4
.github/workflows/build.yaml +1 -1
@@ -61,7 +61,7 @@ - name: Install dependencies run: ${VCPKG_ROOT}/vcpkg install openssl lz4 cmocka - name: configure OpenVPN with cmake - run: cmake -S . -B openvpn-build -DUNSUPPORTED_BUILDS=yes -DCMAKE_SYSTEM_NAME=Android -DOPENSSL_ROOT_DIR=${VCPKG_INSTALLED_DIR}/${{ matrix.vcpkg_triplet }} -DENABLE_PKCS11=false -DBUILD_TESTING=true -DCMAKE_ANDROID_ARCH_ABI=${{ matrix.abi }} -DENABLE_LZO=false -DUSE_WERROR=no + run: cmake -S . -B openvpn-build -DUNSUPPORTED_BUILDS=yes -DCMAKE_SYSTEM_NAME=Android -DOPENSSL_ROOT_DIR=${VCPKG_INSTALLED_DIR}/${{ matrix.vcpkg_triplet }} -DENABLE_PKCS11=false -DBUILD_TESTING=true -DCMAKE_ANDROID_ARCH_ABI=${{ matrix.abi }} -DENABLE_LZO=false - name: Build OpenVPN Android binary with cmake run: cmake --build openvpn-build
src/openvpn/route.c +12 -6
@@ -104,6 +104,7 @@#define RTA_SUCCESS 1/* route addition succeeded */ #define RTA_EEXIST 2/* route not added as it already exists */ +#ifndef TARGET_ANDROID static bool add_bypass_address (struct route_bypass *rb,const in_addr_t a) {
@@ -125,6 +126,7 @@ return false; } } +#endif /* ifndef TARGET_ANDROID */ struct route_option_list *new_route_option_list (struct gc_arena *a)
@@ -750,6 +752,7 @@* (not the most beautiful implementation in the world, but portable and * "good enough") */ +#ifndef TARGET_ANDROID static bool route_ipv6_match_host (const struct route_ipv6 *r6,const struct in6_addr *host )
@@ -785,6 +788,7 @@return false; } +#endif /* ifndef TARGET_ANDROID */ bool init_route_ipv6_list(struct route_ipv6_list *rl6,
@@ -2183,7 +2187,7 @@ const struct env_set *es, openvpn_net_ctx_t *ctx) { -#if !defined(TARGET_LINUX ) +#if !defined(TARGET_LINUX ) && !defined(TARGET_ANDROID )const char *network;#if !defined(TARGET_AIX )const char *netmask;
@@ -2191,9 +2195,11 @@#if !defined(TARGET_ANDROID )const char *gateway;#endif -#else /* if !defined(TARGET_LINUX) */ +#else /* if !defined(TARGET_LINUX) && !defined(TARGET_ANDROID) */ +#if !defined(TARGET_ANDROID )int metric;#endif +#endif int is_local_route;if ((r->flags & (RT_DEFINED |RT_ADDED )) != (RT_DEFINED |RT_ADDED ))
@@ -2204,7 +2210,7 @@struct gc_arena gc =gc_new ();struct argv argv =argv_new (); -#if !defined(TARGET_LINUX ) +#if !defined(TARGET_LINUX ) && !defined(TARGET_ANDROID ) network =print_in_addr_t (r->network,0 , &gc);#if !defined(TARGET_AIX ) netmask =print_in_addr_t (r->netmask,0 , &gc);
@@ -2394,10 +2400,10 @@ }#if !defined(_WIN32) -#if !defined(TARGET_LINUX ) +#if !defined(TARGET_LINUX ) && !defined(TARGET_ANDROID )const char *gateway;#endif -#if !defined(TARGET_SOLARIS ) +#if !defined(TARGET_SOLARIS ) && !defined(TARGET_ANDROID )bool gateway_needed = false;const char *device = tt->actual_name;if (r6->iface !=NULL )/* vpn server special route */
@@ -2421,7 +2427,7 @@struct argv argv =argv_new (); network =print_in6_addr ( r6->network,0 , &gc); -#if !defined(TARGET_LINUX ) && !defined(_WIN32) +#if !defined(TARGET_LINUX ) && !defined(_WIN32) && !defined(TARGET_ANDROID ) gateway =print_in6_addr ( r6->gateway,0 , &gc);#endif
src/openvpn/tun.c +1 -2
@@ -1888,7 +1888,7 @@#endif -#if !(defined(_WIN32) || defined(TARGET_LINUX ) || defined(TARGET_SOLARIS )) +#if !(defined(_WIN32) || defined(TARGET_LINUX ) || defined(TARGET_SOLARIS ) || defined(TARGET_ANDROID ))static void open_tun_generic (const char *dev,const char *dev_type,const char *dev_node,struct tuntap *tt)
@@ -2062,7 +2062,6 @@ openvpn_net_ctx_t *ctx) {#define ANDROID_TUNNAME "vpnservice-tun" -struct user_pass up;struct gc_arena gc =gc_new ();bool opentun;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/894?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I33d1d04b59c62e87ab61d768a7201124ccdabd07
Gerrit-Change-Number: 894
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/894?usp=email )
Change subject: Fix warnings on Android about unused variables/methods
......................................................................
Patch Set 4: Code-Review-1
(2 comments)
File src/openvpn/route.c:
http://gerrit.openvpn.net/c/openvpn/+/894/comment/470b662e_6ebf7798 :
PS4, Line 2195: defined
This check is now obsolete
http://gerrit.openvpn.net/c/openvpn/+/894/comment/605dd637_54f45760 :
PS4, Line 2198: /*
can be changed to #elif
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/894?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I33d1d04b59c62e87ab61d768a7201124ccdabd07
Gerrit-Change-Number: 894
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Wed, 05 Mar 2025 13:45:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, plaisthos.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/894?usp=email
to look at the new patch set (#5).
The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld
Change subject: Fix warnings on Android about unused variables/methods
......................................................................
Fix warnings on Android about unused variables/methods
Add the things we do not use to the print message to avoid ifdefs around the otherwise unused variables.
---
M .github/workflows/build.yaml
M src/openvpn/route.c
M src/openvpn/tun.c
3 files changed, 13 insertions(+), 9 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/94/894/5
.github/workflows/build.yaml +1 -1
@@ -58,7 +58,7 @@ -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=28 \ -DCMAKE_ANDROID_ARCH_ABI=${{ matrix.abi }} \ -DOPENSSL_ROOT_DIR=${VCPKG_INSTALLED_DIR}/${{ matrix.vcpkg_triplet }} \ - -DENABLE_PKCS11=false -DBUILD_TESTING=true -DENABLE_LZO=false -DUSE_WERROR=no + -DENABLE_PKCS11=false -DBUILD_TESTING=true -DENABLE_LZO=false - name: Build OpenVPN Android binary with cmake run: cmake --build openvpn-build
src/openvpn/route.c +11 -6
@@ -102,6 +102,7 @@#define RTA_SUCCESS 1/* route addition succeeded */ #define RTA_EEXIST 2/* route not added as it already exists */ +#ifndef TARGET_ANDROID static bool add_bypass_address (struct route_bypass *rb,const in_addr_t a) {
@@ -123,6 +124,7 @@ return false; } } +#endif struct route_option_list *new_route_option_list (struct gc_arena *a)
@@ -2035,9 +2037,7 @@#if !defined(TARGET_AIX )const char *netmask;#endif -#if !defined(TARGET_ANDROID )const char *gateway; -#endif #else /* if !defined(TARGET_LINUX) */ int metric;#endif
@@ -2056,10 +2056,8 @@#if !defined(TARGET_AIX ) netmask =print_in_addr_t (r->netmask,0 , &gc);#endif -#if !defined(TARGET_ANDROID ) gateway =print_in_addr_t (r->gateway,0 , &gc);#endif -#endif is_local_route =local_route (r->network, r->netmask, r->gateway, rgi);if (is_local_route ==LR_ERROR )
@@ -2165,9 +2163,13 @@openvpn_execve_check (&argv, es,0 ,"ERROR: OpenBSD/NetBSD route delete command failed" );#elif defined(TARGET_ANDROID ) +/* Avoids the unused variables warnings that all other platforms use +* by adding them to the error message. */ msg (D_ROUTE_DEBUG ,"Deleting routes on Android is not possible/not " "needed. The VpnService API allows routes to be set " -"on connect only and will clean up automatically." ); +"on connect only and will clean up automatically. " +"Tried to delete route %s netmask %s gateway %s" , + network, netmask, gateway);#elif defined(TARGET_AIX ) {
@@ -2349,7 +2351,10 @@#elif defined(TARGET_ANDROID )msg (D_ROUTE_DEBUG ,"Deleting routes on Android is not possible/not " "needed. The VpnService API allows routes to be set " -"on connect only and will clean up automatically." ); +"on connect only and will clean up automatically. " +"Tried to delete %s gateway %s" , + network, + gateway_needed ? gateway :"(not needed)" );#elif defined(TARGET_HAIKU )/* ex: route delete /dev/net/ipro1000/0 inet6 :: gw beef::cafe prefixlen 64 */
src/openvpn/tun.c +1 -2
@@ -1806,7 +1806,7 @@#endif -#if !(defined(_WIN32) || defined(TARGET_LINUX ) || defined(TARGET_SOLARIS )) +#if !(defined(_WIN32) || defined(TARGET_LINUX ) || defined(TARGET_SOLARIS ) || defined(TARGET_ANDROID ))static void open_tun_generic (const char *dev,const char *dev_type,const char *dev_node,struct tuntap *tt) {
@@ -1973,7 +1973,6 @@ openvpn_net_ctx_t *ctx) {#define ANDROID_TUNNAME "vpnservice-tun" -struct user_pass up;struct gc_arena gc =gc_new ();bool opentun;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/894?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I33d1d04b59c62e87ab61d768a7201124ccdabd07
Gerrit-Change-Number: 894
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Attention is currently required from: flichtenheld.
plaisthos has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/894?usp=email )
Change subject: Fix warnings on Android about unused variables/methods
......................................................................
Patch Set 5:
(1 comment)
File src/openvpn/route.c:
http://gerrit.openvpn.net/c/openvpn/+/894/comment/532638b8_c0e026ba?usp=email :
PS4, Line 2195: defined
Quoted 1 line
This check is now obsolete
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/894?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I33d1d04b59c62e87ab61d768a7201124ccdabd07
Gerrit-Change-Number: 894
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Thu, 18 Dec 2025 17:45:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/894?usp=email )
Change subject: Fix warnings on Android about unused variables/methods
......................................................................
Patch Set 5: Code-Review+2
(1 comment)
File src/openvpn/route.c:
http://gerrit.openvpn.net/c/openvpn/+/894/comment/631ebe8d_1141ea69?usp=email :
PS4, Line 2198: /*
Quoted 1 line
can be changed to
#elif
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/894?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I33d1d04b59c62e87ab61d768a7201124ccdabd07
Gerrit-Change-Number: 894
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Fri, 19 Dec 2025 13:08:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: flichtenheld <[email protected]...>
PATCH v5 1/1 Fix warnings on Android about unused variables/methods
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]...>
Add the things we do not use to the print message to avoid ifdefs around the otherwise unused variables.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/894
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/894
This mail reflects revision 5 of this Change.
Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>
.github/workflows/build.yaml +1 -1
@@ -58,7 +58,7 @@ -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=28 \ -DCMAKE_ANDROID_ARCH_ABI=${{ matrix.abi }} \ -DOPENSSL_ROOT_DIR=${VCPKG_INSTALLED_DIR}/${{ matrix.vcpkg_triplet }} \ - -DENABLE_PKCS11=false -DBUILD_TESTING=true -DENABLE_LZO=false -DUSE_WERROR=no + -DENABLE_PKCS11=false -DBUILD_TESTING=true -DENABLE_LZO=false - name: Build OpenVPN Android binary with cmake run: cmake --build openvpn-build
src/openvpn/route.c +11 -6
@@ -102,6 +102,7 @@#define RTA_SUCCESS 1/* route addition succeeded */ #define RTA_EEXIST 2/* route not added as it already exists */ +#ifndef TARGET_ANDROID static bool add_bypass_address (struct route_bypass *rb,const in_addr_t a) {
@@ -123,6 +124,7 @@ return false; } } +#endif struct route_option_list *new_route_option_list (struct gc_arena *a)
@@ -2035,9 +2037,7 @@#if !defined(TARGET_AIX )const char *netmask;#endif -#if !defined(TARGET_ANDROID )const char *gateway; -#endif #else /* if !defined(TARGET_LINUX) */ int metric;#endif
@@ -2056,10 +2056,8 @@#if !defined(TARGET_AIX ) netmask =print_in_addr_t (r->netmask,0 , &gc);#endif -#if !defined(TARGET_ANDROID ) gateway =print_in_addr_t (r->gateway,0 , &gc);#endif -#endif is_local_route =local_route (r->network, r->netmask, r->gateway, rgi);if (is_local_route ==LR_ERROR )
@@ -2165,9 +2163,13 @@openvpn_execve_check (&argv, es,0 ,"ERROR: OpenBSD/NetBSD route delete command failed" );#elif defined(TARGET_ANDROID ) +/* Avoids the unused variables warnings that all other platforms use +* by adding them to the error message. */ msg (D_ROUTE_DEBUG ,"Deleting routes on Android is not possible/not " "needed. The VpnService API allows routes to be set " -"on connect only and will clean up automatically." ); +"on connect only and will clean up automatically. " +"Tried to delete route %s netmask %s gateway %s" , + network, netmask, gateway);#elif defined(TARGET_AIX ) {
@@ -2349,7 +2351,10 @@#elif defined(TARGET_ANDROID )msg (D_ROUTE_DEBUG ,"Deleting routes on Android is not possible/not " "needed. The VpnService API allows routes to be set " -"on connect only and will clean up automatically." ); +"on connect only and will clean up automatically. " +"Tried to delete %s gateway %s" , + network, + gateway_needed ? gateway :"(not needed)" );#elif defined(TARGET_HAIKU )/* ex: route delete /dev/net/ipro1000/0 inet6 :: gw beef::cafe prefixlen 64 */
src/openvpn/tun.c +1 -2
@@ -1806,7 +1806,7 @@#endif -#if !(defined(_WIN32) || defined(TARGET_LINUX ) || defined(TARGET_SOLARIS )) +#if !(defined(_WIN32) || defined(TARGET_LINUX ) || defined(TARGET_SOLARIS ) || defined(TARGET_ANDROID ))static void open_tun_generic (const char *dev,const char *dev_type,const char *dev_node,struct tuntap *tt) {
@@ -1973,7 +1973,6 @@ openvpn_net_ctx_t *ctx) {#define ANDROID_TUNNAME "vpnservice-tun" -struct user_pass up;struct gc_arena gc =gc_new ();bool opentun;
[Openvpn-devel] [PATCH applied] Re: Fix warnings on Android about unused variables/methods
This is much better than the previous one - not adding #ifdef's, but actually taking some away - nice trick that ;-)
BB says "it compiles for all platforms, including Android, with no warnings anymore". GHA is happy as well. So is Frank. In it goes!
Your patch has been applied to the master branch.
commit 4859d259f2eccb1dae7c432da944ba93467d1d5d
Author: Arne Schwabe Date: Fri Dec 19 14:47:06 2025 +0100
Fix warnings on Android about unused variables/methods
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: Frank Lichtenheld <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/894
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35156.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#6) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/894?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
Change subject: Fix warnings on Android about unused variables/methods
......................................................................
Fix warnings on Android about unused variables/methods
Add the things we do not use to the print message to avoid ifdefs around the otherwise unused variables.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/894
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35156.html
---
M .github/workflows/build.yaml
M src/openvpn/route.c
M src/openvpn/tun.c
3 files changed, 13 insertions(+), 9 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/94/894/6
.github/workflows/build.yaml +1 -1
@@ -58,7 +58,7 @@ -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=28 \ -DCMAKE_ANDROID_ARCH_ABI=${{ matrix.abi }} \ -DOPENSSL_ROOT_DIR=${VCPKG_INSTALLED_DIR}/${{ matrix.vcpkg_triplet }} \ - -DENABLE_PKCS11=false -DBUILD_TESTING=true -DENABLE_LZO=false -DUSE_WERROR=no + -DENABLE_PKCS11=false -DBUILD_TESTING=true -DENABLE_LZO=false - name: Build OpenVPN Android binary with cmake run: cmake --build openvpn-build
src/openvpn/route.c +11 -6
@@ -102,6 +102,7 @@#define RTA_SUCCESS 1/* route addition succeeded */ #define RTA_EEXIST 2/* route not added as it already exists */ +#ifndef TARGET_ANDROID static bool add_bypass_address (struct route_bypass *rb,const in_addr_t a) {
@@ -123,6 +124,7 @@ return false; } } +#endif struct route_option_list *new_route_option_list (struct gc_arena *a)
@@ -2035,9 +2037,7 @@#if !defined(TARGET_AIX )const char *netmask;#endif -#if !defined(TARGET_ANDROID )const char *gateway; -#endif #else /* if !defined(TARGET_LINUX) */ int metric;#endif
@@ -2056,10 +2056,8 @@#if !defined(TARGET_AIX ) netmask =print_in_addr_t (r->netmask,0 , &gc);#endif -#if !defined(TARGET_ANDROID ) gateway =print_in_addr_t (r->gateway,0 , &gc);#endif -#endif is_local_route =local_route (r->network, r->netmask, r->gateway, rgi);if (is_local_route ==LR_ERROR )
@@ -2165,9 +2163,13 @@openvpn_execve_check (&argv, es,0 ,"ERROR: OpenBSD/NetBSD route delete command failed" );#elif defined(TARGET_ANDROID ) +/* Avoids the unused variables warnings that all other platforms use +* by adding them to the error message. */ msg (D_ROUTE_DEBUG ,"Deleting routes on Android is not possible/not " "needed. The VpnService API allows routes to be set " -"on connect only and will clean up automatically." ); +"on connect only and will clean up automatically. " +"Tried to delete route %s netmask %s gateway %s" , + network, netmask, gateway);#elif defined(TARGET_AIX ) {
@@ -2349,7 +2351,10 @@#elif defined(TARGET_ANDROID )msg (D_ROUTE_DEBUG ,"Deleting routes on Android is not possible/not " "needed. The VpnService API allows routes to be set " -"on connect only and will clean up automatically." ); +"on connect only and will clean up automatically. " +"Tried to delete %s gateway %s" , + network, + gateway_needed ? gateway :"(not needed)" );#elif defined(TARGET_HAIKU )/* ex: route delete /dev/net/ipro1000/0 inet6 :: gw beef::cafe prefixlen 64 */
src/openvpn/tun.c +1 -2
@@ -1806,7 +1806,7 @@#endif -#if !(defined(_WIN32) || defined(TARGET_LINUX ) || defined(TARGET_SOLARIS )) +#if !(defined(_WIN32) || defined(TARGET_LINUX ) || defined(TARGET_SOLARIS ) || defined(TARGET_ANDROID ))static void open_tun_generic (const char *dev,const char *dev_type,const char *dev_node,struct tuntap *tt) {
@@ -1973,7 +1973,6 @@ openvpn_net_ctx_t *ctx) {#define ANDROID_TUNNAME "vpnservice-tun" -struct user_pass up;struct gc_arena gc =gc_new ();bool opentun;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/894?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I33d1d04b59c62e87ab61d768a7201124ccdabd07
Gerrit-Change-Number: 894
Gerrit-PatchSet: 6
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/894?usp=email )
Change subject: Fix warnings on Android about unused variables/methods
......................................................................
Fix warnings on Android about unused variables/methods
Add the things we do not use to the print message to avoid ifdefs around the otherwise unused variables.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/894
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35156.html
---
M .github/workflows/build.yaml
M src/openvpn/route.c
M src/openvpn/tun.c
3 files changed, 13 insertions(+), 9 deletions(-)
.github/workflows/build.yaml +1 -1
@@ -58,7 +58,7 @@ -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=28 \ -DCMAKE_ANDROID_ARCH_ABI=${{ matrix.abi }} \ -DOPENSSL_ROOT_DIR=${VCPKG_INSTALLED_DIR}/${{ matrix.vcpkg_triplet }} \ - -DENABLE_PKCS11=false -DBUILD_TESTING=true -DENABLE_LZO=false -DUSE_WERROR=no + -DENABLE_PKCS11=false -DBUILD_TESTING=true -DENABLE_LZO=false - name: Build OpenVPN Android binary with cmake run: cmake --build openvpn-build
src/openvpn/route.c +11 -6
@@ -102,6 +102,7 @@#define RTA_SUCCESS 1/* route addition succeeded */ #define RTA_EEXIST 2/* route not added as it already exists */ +#ifndef TARGET_ANDROID static bool add_bypass_address (struct route_bypass *rb,const in_addr_t a) {
@@ -123,6 +124,7 @@ return false; } } +#endif struct route_option_list *new_route_option_list (struct gc_arena *a)
@@ -2035,9 +2037,7 @@#if !defined(TARGET_AIX )const char *netmask;#endif -#if !defined(TARGET_ANDROID )const char *gateway; -#endif #else /* if !defined(TARGET_LINUX) */ int metric;#endif
@@ -2056,10 +2056,8 @@#if !defined(TARGET_AIX ) netmask =print_in_addr_t (r->netmask,0 , &gc);#endif -#if !defined(TARGET_ANDROID ) gateway =print_in_addr_t (r->gateway,0 , &gc);#endif -#endif is_local_route =local_route (r->network, r->netmask, r->gateway, rgi);if (is_local_route ==LR_ERROR )
@@ -2165,9 +2163,13 @@openvpn_execve_check (&argv, es,0 ,"ERROR: OpenBSD/NetBSD route delete command failed" );#elif defined(TARGET_ANDROID ) +/* Avoids the unused variables warnings that all other platforms use +* by adding them to the error message. */ msg (D_ROUTE_DEBUG ,"Deleting routes on Android is not possible/not " "needed. The VpnService API allows routes to be set " -"on connect only and will clean up automatically." ); +"on connect only and will clean up automatically. " +"Tried to delete route %s netmask %s gateway %s" , + network, netmask, gateway);#elif defined(TARGET_AIX ) {
@@ -2349,7 +2351,10 @@#elif defined(TARGET_ANDROID )msg (D_ROUTE_DEBUG ,"Deleting routes on Android is not possible/not " "needed. The VpnService API allows routes to be set " -"on connect only and will clean up automatically." ); +"on connect only and will clean up automatically. " +"Tried to delete %s gateway %s" , + network, + gateway_needed ? gateway :"(not needed)" );#elif defined(TARGET_HAIKU )/* ex: route delete /dev/net/ipro1000/0 inet6 :: gw beef::cafe prefixlen 64 */
src/openvpn/tun.c +1 -2
@@ -1806,7 +1806,7 @@#endif -#if !(defined(_WIN32) || defined(TARGET_LINUX ) || defined(TARGET_SOLARIS )) +#if !(defined(_WIN32) || defined(TARGET_LINUX ) || defined(TARGET_SOLARIS ) || defined(TARGET_ANDROID ))static void open_tun_generic (const char *dev,const char *dev_type,const char *dev_node,struct tuntap *tt) {
@@ -1973,7 +1973,6 @@ openvpn_net_ctx_t *ctx) {#define ANDROID_TUNNAME "vpnservice-tun" -struct user_pass up;struct gc_arena gc =gc_new ();bool opentun;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/894?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I33d1d04b59c62e87ab61d768a7201124ccdabd07
Gerrit-Change-Number: 894
Gerrit-PatchSet: 6
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>